package jeu;

import devintAPI.MenuAbstrait;
import noyau.Classement;
import noyau.RegroupClass;
import noyau.Test;
import wiimote.WiimoteLink;
import xML.XMLCreation;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * User: Matthieu
 * Date: 11/04/12
 * Time: 21:45
 * To change this template use File | Settings | File Templates.
 */
public class Classement_Fen extends MenuAbstrait{


    private String login;

    public Classement_Fen(Test te,String title,boolean voice,String login) throws Exception {
        super(title, voice,te);
        WiimoteLink.addWiiRemoteListener(this);

        this.login=login;
    }
    protected String[] nomOptions() throws Exception {
        RegroupClass re=new RegroupClass();
        re.charger();

        String tab[]=new String[5];
       int k=re.retrouverClassement(super.te);

        Classement cla=re.getRegroup().get(k);
        for (int i=0;i<6;i++){
            int gg=i+1;
            if (i<cla.getClassement().size())
            tab[i]="En position "+gg +cla.getClassement().get(i).toString();
        }

        return tab;
    }

    /**
     * lance l'action associ�e au bouton n�i la num�rotation est celle du
     * tableau renvoy� par nomOption
     *
     * @throws java.io.IOException
     * @throws org.jdom.JDOMException
     */
    protected void lancerOption(int i) throws Exception {
        // System.out.println(te.get(0).toString());
        WiimoteLink.removeWiiRemoteListener(this);
        
        if (i<5){

            new MenuJeu("menu",voice,login);
        }
        else{
            System.err.println("action non définie");
        }
        dispose();
    }

    @Override
    protected String wavAccueil() {
        // TODO Auto-generated method stub
        return "../ressources/sons/accueil.wav";
    }

    @Override
    protected String wavAide() {
        // TODO Auto-generated method stub
        return "../ressources/sons/aide.wav";
    }
    @Override
    protected String wavObjectif() {
        // TODO Auto-generated method stub
        return "../ressources/sons/objectif.wav";
    }

    @Override
    protected String wavTouche() {
        // TODO Auto-generated method stub
        return "../ressources/sons/touche.wav";
    }

}


